package com.ddddddl.zhangben;

import com.ddddddl.widget.scrollTab.ScrollTabContactAndClusterActivity;
import com.ddddddl.widget.scrollTab.ScrollTab.TabSpec;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Window;
import android.widget.ImageButton;

public class TabActivity extends ScrollTabContactAndClusterActivity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_NO_TITLE);

		addNewTab(R.drawable.icon_edit, "a", EditActivity.class);
		addNewTab(R.drawable.icon_list, "b", AccountListActivity.class);
		addNewTab(R.drawable.icon_stat, "c", StatActivity.class);

	}

	public void addNewTab(int resId, String title, Class<?> cls) {

		ImageButton tabIndicator = (ImageButton) LayoutInflater.from(this)
				.inflate(R.layout.uni_tab_top_indicator,
						getTabHost().getTabWidget(), false);

		tabIndicator.setImageResource(resId);

		TabSpec tabSpec = getTabHost().newTabSpec(title)
				.setIndicator(tabIndicator).setContent(new Intent(this, cls));

		getTabHost().addTab(tabSpec);

	}
	
}